package com.come4loves.game.dbproxy.entity;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;

import com.come4loves.core.dbcenter.DBQueueType;
import com.come4loves.core.dbcenter.Entity;
import com.come4loves.core.dbcenter.annotation.Column;
import com.come4loves.core.dbcenter.annotation.Table;

@Table(name="actor", type=DBQueueType.IMPORTANT)
public class Actor extends Entity<Long> {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7847248383473113914L;
	@Column(pk = true)
	private long actorId;
	@Column
	private int serverId;
	@Column
	private int loginTime;
	@Column
	private int logoutTime;
	@Column
	private String sim = "";
	@Column
	private String imei = "";
	@Column
	private String createIP = "";
	@Column
	private String createMac = "";
	@Column
	private String osversion = "";
	@Column
	private String phonetype = "";
	@Column
	private String phoneos = "";
	@Column
	private String language = "";
	@Column
	private String lastLoginIP = "";
	
	@Override
	public Long getPkId() {
		return actorId;
	}

	@Override
	public void setPkId(Long pk) {
		this.actorId = pk;
		
	}

	@Override
	protected Entity<Long> readData(ResultSet rs, int rowNum) throws SQLException {
		Actor actor = new Actor();
		actor.actorId = rs.getLong("actorId");
		actor.serverId = rs.getInt("serverId");
		actor.loginTime = rs.getInt("loginTime");
		actor.logoutTime = rs.getInt("logoutTime");
		actor.sim = rs.getString("sim");
		actor.imei = rs.getString("imei");
		actor.createIP = rs.getString("createIP");
		actor.createMac = rs.getString("createMac");
		actor.osversion = rs.getString("osversion");
		actor.phonetype = rs.getString("phonetype");
		actor.phoneos = rs.getString("phoneos");
		actor.language = rs.getString("language");
		actor.lastLoginIP = rs.getString("lastLoginIP");
		return actor;
	}

	@Override
	protected void hasReadEvent() {
		
	}

	@Override
	protected ArrayList<Object> writeData(Boolean containsPK) {
		ArrayList<Object> values = new ArrayList<Object>();
		if (containsPK) {
			values.add(this.actorId);
		}
		values.add(this.serverId);
		values.add(this.loginTime);
		values.add(this.logoutTime);
		values.add(this.sim);
		values.add(this.imei);
		values.add(this.createIP);
		values.add(this.createMac);
		values.add(this.osversion);
		values.add(this.phonetype);
		values.add(this.phoneos);
		values.add(this.language);
		values.add(this.lastLoginIP);
		return values;
	}

	@Override
	protected void beforeWritingEvent() {
		
	}

	@Override
	protected void disposeBlob() {
		
	}
	
	public int getServerId() {
		return serverId;
	}
	public void setServerId(int serverId) {
		this.serverId = serverId;
	}

	public int getLoginTime() {
		return loginTime;
	}

	public void setLoginTime(int loginTime) {
		this.loginTime = loginTime;
	}

	public int getLogoutTime() {
		return logoutTime;
	}

	public void setLogoutTime(int logoutTime) {
		this.logoutTime = logoutTime;
	}

	public String getSim() {
		return sim;
	}

	public void setSim(String sim) {
		this.sim = sim;
	}

	public String getImei() {
		return imei;
	}

	public void setImei(String imei) {
		this.imei = imei;
	}

	public String getCreateIP() {
		return createIP;
	}

	public void setCreateIP(String createIP) {
		this.createIP = createIP;
	}

	public String getCreateMac() {
		return createMac;
	}

	public void setCreateMac(String createMac) {
		this.createMac = createMac;
	}

	public String getOsversion() {
		return osversion;
	}

	public void setOsversion(String osversion) {
		this.osversion = osversion;
	}

	public String getPhonetype() {
		return phonetype;
	}

	public void setPhonetype(String phonetype) {
		this.phonetype = phonetype;
	}

	public String getPhoneos() {
		return phoneos;
	}

	public void setPhoneos(String phoneos) {
		this.phoneos = phoneos;
	}

	public String getLanguage() {
		return language;
	}

	public void setLanguage(String language) {
		this.language = language;
	}

	public String getLastLoginIP() {
		return lastLoginIP;
	}

	public void setLastLoginIP(String lastLoginIP) {
		this.lastLoginIP = lastLoginIP;
	}
	
	

}
